<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>模板宏</title>
</head>
<body>
<form>
    <label>用户名: </label><input type="text" name="username"><br>
    <label>密码: </label><input type="password" name="password"><br>
    <input type="button" value="登录">
</form>
{% macro input(label='',type='',name='',value='') %}
    <label>{{ label }}</label><input type="{{ type }}" name="{{ name }}" value="{{ value }}">
{% endmacro %}
<h4>演示模板宏</h4>
<form action="">
    {{ input('用户名:',name='username') }}<br>
    {{ input('密码:',type='password',name='password') }}<br>
    {{ input(type='button',value='登录') }}
</form>
<h4>调用模板宏</h4>
{% import 'base_macro.html' as func %}
<form action="">
    {{ func.input('用户名:',name='username') }}<br>
    {{ func.input('密码:',type='password',name='password') }}<br>
    {{ func.input(type='button',value='登录') }}
</form>
</body>
</html>